Problem: Let $a$ and $b$ be positive real numbers.  Find the maximum value of
\[2(a - x)(x + \sqrt{x^2 + b^2})\]in terms of $a$ and $b.$
Explanation: Let $t = x + \sqrt{x^2 + b^2}.$  Then $t - x = \sqrt{x^2 + b^2},$ so
\[(t - x)^2 = x^2 + b^2.\]Expanding, we get
\[t^2 - 2tx + x^2 = x^2 + b^2,\]so
\[x = \frac{t^2 - b^2}{2t}.\]Hence,
\begin{align*}
2(a - x)(x + \sqrt{x^2 + b^2}) &= 2 \left( a - \frac{t^2 - b^2}{2t} \right) t \\
&= 2at - t^2 + b^2 \\
&= a^2 + b^2 - (t - a)^2 \\
&\le a^2 + b^2.
\end{align*}Equality occurs when $t = a$ or $x = \frac{a^2 - b^2}{2a},$ so the maximum value is $\boxed{a^2 + b^2}.$